﻿using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using QuickUIT.Controls;

namespace QuickUIT.Tests
{
    [TestClass]
    public class UIMenuTests
    {
        private BaseState _baseState;

        [TestInitialize]
        public void TestSetup()
        {
            _baseState = new BaseState(TestUtilities.GetTestApplicationFileName(), "@Name='QuickUIT Test Application'");
            _baseState.Execute();
        }

        [TestMethod]
        public void ShouldGetMenu()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UIMenu menu = window.UIMenu("@AutomationId='menu1'");
            Assert.IsNotNull(menu);
        }

        [TestMethod]
        public void ShouldGetAllMenus()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            List<UIMenu> menus = window.UIMenus();
            Assert.AreEqual(1, menus.Count);
            Assert.AreEqual("menu1", menus[0].AutomationId);
        }

        [TestCleanup]
        public void TestTeardown()
        {
            _baseState.Cleanup();
        }
    }
}